package com.pengtu.entity.project;

import java.util.List;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.google.common.collect.Lists;
import com.pengtu.entity.app.Organization;

/**
 * 设计单位
 * @author libitum
 *
 */
@Entity
@DiscriminatorValue("2")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class DesignOrganization extends Organization {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private DesignOrganization organization;		//上级单位
	
	private List<DesignOrganization> childrenOrgans = Lists.newArrayList();
	
	
	
	
	

	@ManyToOne(targetEntity=Organization.class)
	@JoinColumn(name="FATHERORGAN")
	public DesignOrganization getOrganization() {
		return organization;
	}
	public void setOrganization(DesignOrganization organization) {
		this.organization = organization;
	}
	
	@OneToMany(mappedBy="organization")
	public List<DesignOrganization> getChildrenOrgans() {
		return childrenOrgans;
	}
	public void setChildrenOrgans(List<DesignOrganization> childrenOrgans) {
		this.childrenOrgans = childrenOrgans;
	}

}
